<html>
<head>
	<meta charset="UTF-8">
	<meta content="IE=edge" http-equiv="X-UA-Compatible">
	<meta content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width" name="viewport">
	<title>4452：[Cerc2015]Export Estimate</title>
	<!-- css -->
	<link href="../css/base.min.css" rel="stylesheet">
	<link href="../css/project.min.css" rel="stylesheet">
	
	<!-- favicon -->
	<!-- ... -->
</head>
<body class="page-brand">
	<header class="header header-transparent header-waterfall ui-header">
		<ul class="nav nav-list pull-left">
			<li>
				<a data-toggle="menu" href="#menu">
					<span class="icon icon-lg">menu</span>
				</a>
			</li>
		</ul>
		<a class="header-logo header-affix-hide margin-left-no margin-right-no" data-offset-top="213" data-spy="affix">[Cerc2015]Export Estimate</a>
		<span class="header-logo header-affix margin-left-no margin-right-no" data-offset-top="213" data-spy="affix">[Cerc2015]Export Estimate</span>
	</header>
	<nav aria-hidden="true" class="menu" id="menu" tabindex="-1">
		<div class="menu-scroll">
			<div class="menu-content">
				<a class="menu-logo" href="../index.html">BZOJ离线题库</a>
				<ul class="nav">
					<li>
						<a class="waves-attach" data-toggle="collapse" href="#problems">题目</a>
						<ul class="menu-collapse collapse in" id="problems">
							<li>
								<a class="waves-attach" href="../index.html">主页</a>
							</li>
							<li>
								<a class="waves-attach" href="../list.html">题目列表</a>
							</li>
						</ul>
					</li>
					<li>
						<a class="collapsed waves-attach" data-toggle="collapse" href="#about">关于</a>
						<ul class="menu-collapse collapse" id="about">
							<li>
								<a class="waves-attach" href="../about.html">关于此项目</a>
							</li>
						</ul>
					</li>
					
				</ul>
			</div>
		</div>
	</nav>
	<main class="content">
		<div class="content-header ui-content-header">
			<div class="container">
				<h1 class="content-heading">
                [Cerc2015]Export Estimate                </h1>
                <p>时间限制：10s&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  空间限制：128MB</p>			</div>
		</div>
		<div class="container">
			<section class="content-inner margin-top-no">
				<div class="row">
					<div class="col-lg-13 col-md-13">
						<div class="card margin-bottom-no">
							<div class="card-main">
								<div class="card-inner">
									
                                <h3>题目描述</h3><p><div>给你一个n个点m条边的无向图，每条边有权值，我们可以选择一个整数lim来生成一个新的图，过程如下：&nbsp;</div>
<div>1.先将原图中边权小于lim的边删掉&nbsp;</div>
<div>2.依次从1到n枚举每个点&nbsp;</div>
<div>（a）如果这个点没有边于它相连，这个点将会被删去&nbsp;</div>
<div>（b）如果这个点只与两条不相同的边x，y相连，设这两条边的另一个点分别为a，b，如果a，b和这个点都不相同（a，b可以相同），则依次做如下操作：&nbsp;</div>
<div>（i）删去边x，y&nbsp;</div>
<div>（ii）删去这个点&nbsp;</div>
<div>（iii）在a，b之间建立一条新的边&nbsp;</div>
<div>下面这个例子lim=95：&nbsp;</div>
<div><img src="../file/4452_0.png" width="856" height="380" alt="" /></div>
<div></div>
<div>数据保证原图没有重边和自环，但不保证经过如上操作后的图没有重边和自环。&nbsp;</div>
<div>现在我们想知道当lim取若干值时，由原图生成的新图的点数和边数是多少。&nbsp;</div>
<div></div>
<div></div>
<p></p></p><hr/><h3>输入格式</h3><p><div>第一行两个数n，m，表示原图有n点m条边。&nbsp;</div>
<div>接下来m行，每行三个数a，b，c，表示a和b之间有一条边权为c的双向边。&nbsp;</div>
<div>接下来一行一个数q，表示有q次询问。&nbsp;</div>
<div>接下来一行q个数，k1，k2，...，kq。&nbsp;</div>
<div></div>
<p></p></p><hr/><h3>输出格式</h3><p><div>总共q行，每行两个数，表示lim取ki时，生成的新图的点数和边数&nbsp;</div>
<div></div>
<p></p></p><hr/><h3>样例输入</h3><pre>Sample Input1: 
6 7 
1 2 20 
2 3 80 
2 5 100 
3 5 50 
3 4 100 
5 6 90 
4 6 100 
4 
25 75 85 95 
Sample Input2: 
10 14 
2 7 150 
1 2 100 
2 3 150 
3 1 200 
1 4 60 
4 5 20 
2 5 100 
5 6 90 
6 7 120 
7 5 130 
6 8 50 
8 9 200 
9 10 200 
10 7 200 
5 
300 50 95 100 110 

</pre><hr/><h3>样例输出</h3><pre>Sample Output1: 
2 3 
1 1 
2 1 
4 2 
Sample Output2: 
0 0 
6 9 
4 5 
4 5 
5 4 

数据范围： 
1<=n<=300000 
1<=m<=300000 
0<=c<=300000 
1<=q<=300000 
0<=ki<=300000 </pre><hr/><h3>提示</h3><p>没有写明提示</p><hr/><h3>题目来源</h3><p>没有写明来源</p>
								</div>
							</div>
						</div>
					</div>
				</div>
				
				
			</section>
		</div>
	</main>

	<div class="fbtn-container">
		<div class="fbtn-inner">
			<a class="fbtn fbtn-lg fbtn-brand-accent waves-attach waves-circle waves-light waves-effect" data-toggle="dropdown" aria-expanded="true"><span class="fbtn-text fbtn-text-left">Menu</span><span class="fbtn-ori icon">apps</span><span class="fbtn-sub icon">close</span></a>
			<div class="fbtn-dropup">
				<a class="fbtn fbtn-brand waves-attach waves-circle waves-light waves-effect" href="../list.html" target="_self"><span class="fbtn-text fbtn-text-left">题目列表</span><span class="icon">menu</span></a>
				<a class="fbtn fbtn-green waves-attach waves-circle waves-effect" href="../index.html" target="_self"><span class="fbtn-text fbtn-text-left">返回主页</span><span class="icon">home</span></a>
				<a class="fbtn waves-attach waves-circle waves-effect" href="http://www.lydsy.com/JudgeOnline/submitpage.php?id=4452" target="_blank"><span class="fbtn-text fbtn-text-left">提交代码</span><span class="icon">send</span></a>
				<a class="fbtn fbtn-orange waves-attach waves-circle waves-effect" href="http://www.lydsy.com/JudgeOnline/wttl/wttl.php?pid=4452" target="_blank"><span class="fbtn-text fbtn-text-left">试题讨论</span><span class="icon">chat</span></a>
				
			</div>
		</div>
	</div>

	<!-- js -->
	<script src="../js/jquery.min.js"></script>
	<script src="../js/base.min.js"></script>
	<script src="../js/project.min.js"></script>
</body>
</html>